﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using DTO;
using DAO;

namespace BUS
{
    public class BookBUS
    {
        BookDAO bookDAO = new BookDAO();

        public BindingList<BookDTO> GetNewBindingList()
        {
            return bookDAO.GetNewBindingList();
        }

        public int InsertBook(BookDTO bookDto)
        {
            if (bookDAO.CheckExistsCode(bookDto.BookCode))
            {
                return 0;
            }
            return bookDAO.InsertBook(bookDto);
        }

        public bool UpdateBook(BookDTO bookDto)
        {
            return bookDAO.UpdateBook(bookDto);
        }

        public BookDTO GetBookByID(int ID)
        {
            return bookDAO.GetBookByID(ID);
        }

        public bool DeleteBook(int ID)
        {
            return bookDAO.DeleteBook(ID);
        }

        public List<BookReportDTO> GetListBookForReport(DateTime from, DateTime to)
        {
            return bookDAO.GetListBookForReport(from, to);
        }
    }
}
